﻿<p>
    This example shows the client-side events supported by Telerik Slider for ASP.NET MVC and Telerik RangeSlider for ASP.NET MVC.
</p>
<p>
    The Slider and RangeSlider have the following events:
</p>
<ul>
    <li>
        The <em>OnLoad</em> event is raised when the components are initialized. You can subscribe to that event by using one of the two overloads of the <strong>OnLoad</strong> method. 
        The one accepts Action as an argument - the other accepts a String.
        Use the Action overload to define the event handler inline. Use the String overload
        to specify the name of the JavaScript function which handles the event. The following code shows both options:
<pre class="prettyprint">
&lt;%= Html.Telerik().Slider()
        .Name("Slider")
        .ClientEvents(events => events
            <em>.OnLoad("onLoad")</em>
        )
</pre>
or
<pre class="prettyprint">
&lt;% Html.Telerik().Slider()
       .Name("Slider")
       .ClientEvents(events => events
       <em>.OnLoad(() => 
       {
        %&gt;
         function(e) {
             //perform required actions here.
         }
        &lt;%
       })</em>
       .Render();
</pre>
    </li>
    <li>
        The <em>OnChange</em> event is raised when the currently value is changed. You can subscribe to that event by using one of the two overloads of the <strong>OnChange</strong> method: 
<pre class="prettyprint">
&lt;%= Html.Telerik().Slider()
        .Name("Slider")
        .ClientEvents(events => events
            <em>.OnChange("onChange")</em>
        )
</pre>
or
<pre class="prettyprint">
&lt;% Html.Telerik().Slider()
       .Name("Slider")
       .ClientEvents(events => events
       <em>.OnChange(() => 
       {
           %&gt;
            function(e) {
                //perform required actions here.
            }
           &lt;%
       })</em>
       .Render();
</pre>
    </li>
    <li>
        The <em>OnSlide</em> event is raised when drag handle is moved. You can subscribe to that event by using one of the two overloads of the <strong>OnSlide</strong> method: 
<pre class="prettyprint">
&lt;%= Html.Telerik().Slider()
        .Name("Slider")
        .ClientEvents(events => events
            <em>.OnSlide("onSlide")</em>
        )
</pre>
or
<pre class="prettyprint">
&lt;% Html.Telerik().Slider()
       .Name("Slider")
       .ClientEvents(events => events
       <em>.OnSlide(() => 
       {
           %&gt;
            function(e) {
                //perform required actions here.
            }
           &lt;%
       })</em>
       .Render();
</pre>
    </li>
</ul>